﻿import com.dinmax.isolution.*

class ThemesBarGUI
extends MovieClip {
	
	private var listener:Object;	
	private var activeButton:AppThemeButtonGUI;
	
	function ThemesBarGUI(){
		return;
	}
	
	function onLoad(){
		//this.listener = ISAppGUI.getActive().registerButtonBar(this);
		return;
	}
	
	public function registerChild(btn:AppThemeButtonGUI):Void {
		switch(btn._name){
			case "mcEnergy":
			btn.setThemeID("0");
			break;
			
			case "mcRain":
			btn.setThemeID("1");	
			break;
			
			case "mcReading":
			btn.setThemeID("2");
			break;
			
			case "mcNormal":
			btn.setThemeID("3");
			break;
			
			case "mcDespertar":
			btn.setThemeID("100");
			break;
			
			case "mcCine":
			btn.setThemeID("101");
			break;
			
			case "mcDepto":
			btn.setThemeID("102");
			break;
			
			case "mcFiesta":
			btn.setThemeID("103");
			break;
		}
		return;
	}
	
	public function onChange(btn:AppThemeButtonGUI, type:String):Void {
		if(type == "enabled") {
			trace("ThemesBarGUI onChange");
			if(btn.getEnabled() && btn != activeButton){
				activeButton.setEnabled(false);
				activeButton = btn;
				com.dinmax.isolution.HCC.launchTheme(btn.getThemeID());
												
			} else if(!btn.getEnabled() && btn==activeButton) {
				activeButton = null;
				
			}
		}
		return;
	}
	
	public function refresh():Void {
		var themes:Array = HCC.getThemes();
		
		return;
	}
	
	
}